<?php
  
class Purchase {

  # $tickets is an array of tickets
  function __construct( $tickets, $TAX_RATE ) {
    $this->numTickets = 0;
    
    foreach ($tickets as $temp) {
      $this->subtotal += $temp->price;
      $this->numTickets++;
    }
    
    $this->total = $this->subtotal + ($this->subtotal * $TAX_RATE);
  }
}

?>
